package lab02.test21;

/**
 *
 * 21、 	统计一个字符串中给定字符出现的频率。
 * Created by AIR on 2017/10/30.
 */
public class Test {
    public static int counter(String s,char c){
        int count=0;
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)==c){
                count++;
            }
        }
        return count;
    }
    public static void main(String args[]){
        System.out.println(new Test().counter("YIYANGQIANXI",'Y'));
    }
}
